package com.devo.icecream.ui.order

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.*
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.buildAnnotatedString
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import com.devo.icecream.R
import com.devo.icecream.ui.theme.Main
import com.devo.icecream.ui.theme.textGreyColor
import com.devo.icecream.ui.theme.yellow

@Composable
fun MakeErrorLayout(price: Float) {
    Column(
        modifier = Modifier
            .wrapContentHeight()
            .fillMaxWidth(),
        horizontalAlignment = Alignment.CenterHorizontally,
    ) {

        Image(painter = painterResource(id = R.mipmap.time), contentDescription = "")

        Spacer(modifier = Modifier.height(34.dp))

        Text(
            buildAnnotatedString {
                append("￥")
                withStyle(style = SpanStyle(fontSize = MaterialTheme.typography.h1.fontSize)) {
                    append("%.02f".format(price))
                }
                append(", 退款中")
            },
            color = Main,
            fontSize = MaterialTheme.typography.h2.fontSize
        )
        Spacer(modifier = Modifier.height(24.dp))

        Text(text = "Oops,设备在闹小情绪!", style = MaterialTheme.typography.h1)

        Spacer(modifier = Modifier.height(24.dp))

        Text(
            text = "十分抱歉！您的款项会实时返回！",
            fontSize = MaterialTheme.typography.body1.fontSize,
            color = yellow,
        )

        Spacer(modifier = Modifier.height(24.dp))

        Text(
            text = "我们的工程师会尽快解决！感谢您的信任和支持，欢迎下次再来！",
            fontSize = MaterialTheme.typography.body1.fontSize,
            color = textGreyColor,
        )

    }

}